<admintpl file="header" />

<link href="__TMPL__Public/assets/css/infomation.css" rel="stylesheet" />
</head>
<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:U('SiteVisa/index')}">现场签证流程单管理</a></li>
            <if condition="($Role eq 2) AND ($userrole['role'] eq 5)">           
                <li><a href="{:U('SiteVisa/add')}">新增现场签 证流程单</a></li>
            </if>
            <li class="active"><a href="{:U('SiteVisa/view', array('id'=>I('request.id/s','')))}">查看现场签证流程单</a></li>
        </ul> 
        <section class="tab-pane active fade in" id="access">
            <div class="row">
                <div class="col-xs-12 col-md-12 col-lg-12">
                    <div class="panel panel-info">
                        <div class="panel-body">
                            <form method="post" class="form-horizontal form-inline tg" action="{:U('SiteVisa/audit_post')}" method="post">
                                <input type="hidden" name="table_id" value="{$result.id}" />
                                <input type="hidden" name="audit_level" value="{$result.audit_level}" />                           
                                <div class="row tg-header">
                                    <div class="col-md-12 text-center">
                                        <h3>现场签证流程单</h3>
                                    </div>
                                    <div class="col-md-12">
                                        <p class="tg-to">
                                            <label>工程名称:</label><input type="text" class="input-xt"  disabled value="{$job_name}" readonly/>
                                        </p>
                                        <p class="tg-to" style="margin-left: 100px">
                                            <label>所属合同（联系单）:</label>
                                            <input type="text" class="input-xt" value="{$result.contract}" required/>
                                        </p>
                                        <p class="pull-right tg-serialnum">
                                            <label>编号:</label>
                                            <input class="input-xt" name="code" type="text" value="{$result.code}" required/>
                                        </p>
                                    </div>
                                </div>
                                <table class="table table-bordered">
                                    <tr>
                                        <td style="border-right:none !important;" colspan="2">
                                            <label>事项名称:</label>
                                        </td>
                                        <td colspan="3">
                                            <input type="text" name="consignee_department" class="input-xt input-deptname" style="border:none !important;" required value="{$result.consignee_department}" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <label>适用范围:</label>
                                        </td>
                                        <td>
                                            <input type="text" name="applicability" class="input-xt input-deptname" style="border:none !important;" value="{$result.applicability}" required />
                                        </td>
                                        <td>
                                            <label>提出日期:</label>
                                        </td>
                                        <td>
                                            <input type="text" name="preview_date" class="js-date input-xt input-deptname" style="border:none !important;" required value="<php>echo date('Y-m-d');</php>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <label>签证原因:</label>
                                        </td>
                                        <td colspan="3">
                                            <input type="text" name="preview_title" class="input-xt input-deptname" style="border:none !important;" value="{$result.reasons}" required />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="td-center">
                                            <label>
                                                <p>签</p>
                                                <p>证</p>
                                                <p>内</p>
                                                <p>容:</p>
                                            </label>
                                        </td>
                                        <td colspan="4">
                                            <textarea style="height:100px; width:100%">{$result.main_content}</textarea>
                                            <p class="tg-content">
                                                附件：
                                                <foreach name="results" item="vo">
                                                    <div class='controls' style='margin-top:10px;margin-left:20px'>
                                                        <a target="_blank" path="{$vo.file_path}" name="{$vo.file_name}" class="fileDownload" data-type="{$vo.file_type}"><label>{$vo.file_name}</label></a>
                                                    </div>
                                                </foreach>
                                            </p>
                                            <span style="float: left ;">经办人</span>

                                            <div style="float: right; margin-right: 280px">
                                                <p>项目负责人：</p>
                                                <p>施工单位（盖章）：</p>
                                                <p>
                                                    <span>{$result.publish_time|substr=0,4}&nbsp;年&nbsp;{$result.publish_time|substr=5,2}月&nbsp;{$result.publish_time|substr=8,2}日</span>
                                                </p>
                                            </div>
                                        </td>
                                    </tr>

                                    <if condition="($audit[3] OR $isAudit eq '2') AND $result['audit_level'] egt 5">
                                        <tr>
                                            <td rowspan="3" class="td-center">
                                                <label>
                                                    <p>签</p>
                                                    <p>证</p>
                                                    <p>审</p>
                                                    <p>核</p>
                                                    <p>意</p>
                                                    <p>见</p>
                                                </label>
                                            </td>

                                            <td class="td-center">
                                                <p>监理</p>
                                                <p>单位</p>
                                            </td>
                                            <td colspan="4">
                                                <label>审核意见：
                                                    <if condition="$audit[3]['audit_status'] eq 2">&nbsp;驳回<else />&nbsp;同意</if>
                                                </label>
                                                <textarea style="height:100px; width:100%">{$audit.3.audit_reason}</textarea>
                                                <span style="float: left ;">监理现场负责人</span>

                                                <div style="float: right; margin-right: 200px">
                                                    <p>监理工程师：</p>
                                                    <p>监理单位（盖章）：</p>
                                                    <p>
                                                        <span>日期</span>
                                                        <span  class="signature-date1">年</span>
                                                        <span  class="signature-date1">月</span>
                                                        <span  class="signature-date1">日</span>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                    </if>

                                    <if condition="($audit[5] OR $isAudit eq '2') AND $result['audit_level'] egt 7">
                                        <tr>
                                            <td class="td-center">
                                                <p>代建</p>
                                                <p>单位</p>
                                            </td>
                                            <td colspan="4">
                                                <label>审核意见：
                                                    <if condition="$audit[5]['audit_status'] eq 2">&nbsp;驳回<else />&nbsp;同意</if>
                                                </label>
                                                <textarea style="height:100px; width:100%">{$audit.5.audit_reason}</textarea>
                                                <span style="float: left ;">现场负责人</span>

                                                <div style="float: right; margin-right: 200px">
                                                    <p>项目负责人：</p>
                                                    <p>代建单位（盖章）：</p>
                                                    <p>
                                                        <span>日期</span>
                                                        <span class="signature-date1">年</span>
                                                        <span class="signature-date1">月</span>
                                                        <span class="signature-date1">日</span>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                    </if>
                                    <if condition="($audit[7] OR $isAudit eq '2') AND $result['audit_level'] egt 9">
                                        <tr>
                                            <td class="td-center">
                                                <p>建设</p>
                                                <p>单位</p>
                                            </td>
                                            <td colspan="4">
                                                <label>审核意见：
                                                    <if condition="$audit[7]['audit_status'] eq 2">&nbsp;驳回<else />&nbsp;同意</if>
                                                </label>
                                                <textarea style="height:100px; width:100%">{$audit.7.audit_reason}</textarea>
                                                <span style="float: left ;">现场经办人</span>

                                                <div style="float: right; margin-right: 200px">
                                                    <p>项目负责人：</p>
                                                    <p>建设单位（盖章）：</p>
                                                    <p>
                                                        <span>日期</span>
                                                        <span class="signature-date1">年</span>
                                                        <span class="signature-date1">月</span>
                                                        <span class="signature-date1">日</span>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                    </if>

                                    <if condition="$result['audit_status'] eq '2'">
                                        <tr>
                                            <td colspan="4">
                                                <label>审查意见：&nbsp;驳回</label>
                                                <textarea style="height:50px; width:100%" readonly >{$reject.audit_reason}</textarea>
                                            </td>
                                        </tr>
                                    </if>
                                    <if condition="$isAudit eq '2'">
                                        <tr>
                                            <td colspan="5" width="100%">
                                                <label>审查意见：
                                                    <if condition="$audit['audit_status'] eq 2">
                                                        <label style="width:50px;"><input type="radio" name="audit_status" value="1" />&nbsp;同意</label>
                                                        <label style="width:50px;"><input type="radio" name="audit_status" value="2" checked />&nbsp;驳回</label>
                                                        <else />
                                                        <label style="width:50px;"><input type="radio" name="audit_status" value="1" checked />&nbsp;同意</label>
                                                        <label style="width:50px;"><input type="radio" name="audit_status" value="2" />&nbsp;驳回</label>
                                                    </if>
                                                </label>
                                                <textarea style="height:50px; width:100%" name="audit_reason" >{$audit.audit_reason}</textarea>

                                                <div>
                                                    <p class="signature-date">
                                                        <span>年</span>
                                                        <span>月</span>
                                                        <span>日</span>
                                                    </p>
                                                </div>
                                            </td>
                                        </tr>
                                    </if> 
                                    <!-- </if> -->                                                                 
                                </table>
                                <if condition="$result['audit_level'] eq 1">
                                    <input type="hidden" name="audit_status" value="1" />
                                    <input type="hidden" name="audit_reason" value="变更保存" />
                                </if>                                
                                <p class="text-muted tg-note">
                                    <small>备注：本表一式5份，发包人项目部一份（原件），承包人二份（原件含备案）、代建监理各一份（原件）</small>
                                </p>
                                <div class="form-actions">
                                    <if condition="$isAudit eq '2'">                           
                                        <button type="submit" class="btn btn-primary js-ajax-submit clickBtn" href="javascript:void(0);">{:L('SAVE')}</button>
                                    </if>

                                    <if condition="$result['audit_status'] eq 3">
                                        <a class="btn btn-warning" href="javascript:$.print('#access');">打印</a>
                                    </if>                                    <a class="btn btn-default" href="{:U('SiteVisa/index')}">{:L('BACK')}</a>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <script src="__PUBLIC__/js/common.js"></script>
    <script type="text/javascript" src="__TMPL__Public/assets/js/audit.js"></script>
    <script type="text/javascript">
        if ('{$result.audit_level}' != 1) {
            $("input").attr("readonly", true);
        }
        $(document).ready(function(e) {
            window.obj = '';
            // 选择图片
            $(document).on("click", ".upBtn", function(e) {
                window.obj = $(this);
                $("#upFile").click();
            });
            // 文件选择器change事件
            $("#upFile").on("change", function(){
                UploadFile("{:U('SiteVisa/upload')}", "site_visa");
            });
            $(document).on("click", ".delFile", function(){
                if($(this).attr("value") != undefined){
                    delFile("{:U('SiteVisa/delFile')}", $(this).attr("value"), $(this))
                } else {
                    $(this).closest("div").remove();
                }
            });
        });
    </script>
</body>
</html>